/// 业务异常
class BusinessException implements Exception {
  final int code;
  final String message;
  final String messageCode;
  final String requestKey;
  final bool isRequireCache;

  BusinessException(
    this.code,
    this.message,
    this.messageCode,
    this.requestKey,
    this.isRequireCache,
  );

  String toString() {
    return "errorCode: $code, message: $message, messageCode: $messageCode, requestKey: $requestKey";
  }
}

/// 无网络
class NoNetworkException implements Exception {
  final String requestKey;
  final bool isRequireCache;
  final bool isHasCacheData;
  NoNetworkException(this.requestKey, this.isRequireCache,
      {this.isHasCacheData = false});

  String toString() {
    return "没有网络连接";
  }
}

/// 网络异常
class CommonException implements Exception {
  final String requestKey;
  final bool isRequireCache;

  CommonException(this.requestKey, this.isRequireCache);

  String toString() {
    return "发生错误";
  }
}
